<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class InteractionComment extends Model
{
    public $timestamps = false;
    protected $connection = 'xz';
    protected $table = 'qa_reply';
    use HasFactory;

    public function getCreateTimeAttribute(string $value)
    {
        return Date("Y-m-d H:i:s",$value);
    }

    public function interaction()
    {
        return $this->hasOne('App\Models\Interaction','id','article_id');
    }

    public function user()
    {
        return $this->hasOne('App\Models\Platform_user','id','user_id')->select('id','name','head_img');
    }

    public function likes()
    {
        return $this->hasMany('App\Models\InteractionCommentLike','reply_id','id')->select('id','uid','reply_id');
    }
}
